﻿using Base.Infrastructure.Dto.Request.option;
using Base.Infrastructure.Dto.Request.TestPaper;
using Base.Infrastructure.Dto.Request.Topic;
using Base.Service.Interface;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Base.Api.Admin.Controllers
{
    [Route("api/[controller]/[action]")]
   /* [ApiExplorerSettings(GroupName = "TestPaper")]*///分组
    [ApiController]
    public class TestPaperController : BaseController
    {
        private readonly IQuestionService _questionService;
        private readonly ITestPaperService _testPaperService;

        public TestPaperController(IQuestionService questionService, ITestPaperService testPaperService)
        {
            _questionService = questionService;
            _testPaperService = testPaperService;
        }

        /// <summary>
        /// 添加题目和选项，题目参数:Qcontent/题目，Qexplain/描述，Qsubject/科目，Qtype/题目类型(选择题)，Qlv/等级难度，QisPublish/是否发布(0:未发布/1:已发布)，QisBan/是否禁用(0/未禁用/1:已禁用)
        /// 选项参数：Oqid/题目id(不需填写)，OcontentA/选项A，OcontentB/选项B，OcontentC/选项C，OcontentD/选项D，OisRight/正确答案(A/B/C/D)
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        //[Authorize]
        public IActionResult AddQuestion(QuestionRequestDto question )
        {
            var result = _questionService.AddQuestion(question);
            return Ok(result);
        }

        /// <summary>
        /// 添加试卷和详情，题目参数:TPName/试卷名，TPCIDs/适用班级(暂时为空)，TPTotalScore/总分，TPQCount/题目数量，TPPassScore/及格分数，TPLv/试卷难度1-10，TPLabels/试卷标签，TPAction/组卷方式 1:人工组卷 2:随机组卷 3:人工+随机组卷，TPAuthor/添加人，TPIsBan/是否禁用，TPIsPublish/是否发布
        /// 详情参数：TPDQID/题目ID，TPDScore/题目分数
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        //[Authorize]
        public IActionResult AddTestPaper(TestPaperRequestDto testPaperRequest)
        {
            var result = _testPaperService.AddTestPaper(testPaperRequest);
            return Ok(result);
        }
    }
}
